package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.CusReturnBean;
import com.project.bean.InProductBean;
import com.project.bean.OrderReturnProductBean;
import com.project.bean.SupplyInfoBean;
import com.project.service.IPutInStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("PutInStorage")
public class PutInStorageController {
    @Autowired
    private IPutInStorageService IPutInStorageService;
    @RequestMapping("te")
    void te(){
         IPutInStorageService.te();
    }

    /**
     * 查询所有客户订单退货表
     *
     * @return
     */
    @RequestMapping("findByRejected")
    IPage<CusReturnBean> findByRejected(int pageNO){
        return IPutInStorageService.findByRejected(pageNO);
    }
    /**
     * 通过客户订单id查询该退货订单里面所有的商品
     * @param id
     * @return
     */
    @RequestMapping("findByRejectedId")
    IPage<OrderReturnProductBean> findByRejectedId(int pageNO, String id){
        return IPutInStorageService.findByRejectedId(pageNO,id);
    }

    /**
     * 点击入库
     * 通过客户退货订单的Id将此id的商品入库
     *
     * @param id 客户退货订单的Id
     */
    @RequestMapping("joinRejectedToStorage")
    Boolean joinRejectedToStorage(int id){
        return IPutInStorageService.joinRejectedToStorage(id);
    }

    /**
     * 查出所有的供应商供货订单
     *
     * @return
     */
    @RequestMapping("findBySupplyAll")
    IPage<SupplyInfoBean> findBySupplyAll(int pageNO){
        return IPutInStorageService.findBySupplyAll(pageNO);
    }
    /**
     * 通过供应商供货订单id，查出订单中的所有商品
     * @return
     */
    @RequestMapping("findProductBySupplyId")
    IPage<InProductBean> findProductBySupplyId(int pageNO, int supplyId){
        return IPutInStorageService.findProductBySupplyId(pageNO,supplyId);
    }
    /**
     * 通过供应商供货订单的id，将此供应商的商品全部入库
     *
     * @param id
     */
    @RequestMapping("joinSupplyToStorage")
    boolean joinSupplyToStorage(int id){

        return IPutInStorageService.joinSupplyToStorage(id);
    }
}
